<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function func(arr,fn){
            // console.log(arr,fn);
            // var b = 2;
            for(var i=0;i<arr.length;i++){
                     fn(arr[i]);  //调用的时候传递 实参
            }
        }
        var arr = [1,2,3];
        var arg = function(a){  // 定义的时候 接收形参
            console.log("arg",a)
        }
        func(arr,arg)
    </script>
</body>
</html>